package com.wy.controller;

import com.wy.common.ResultCode;
import com.wy.model.Room;
import com.wy.service.RoomService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @描述
 * @创建人 wangyue
 * @创建时间2019/12/216:25
 */
@Api("restful风格的api示例")
@RestController
@RequestMapping("room")
public class RoomController {

    @Autowired
    private RoomService roomService;

    @RequestMapping("list")
    public ResultCode list(HttpServletRequest request){
        System.out.println("================="+request.getRequestURI());
        List<Room> list = roomService.list();
        return new ResultCode(list);
    }
    @ApiOperation(value = "根据id获取用户",notes = "id必须是数字")
    @ApiImplicitParams({@ApiImplicitParam(name = "id",value = "用户id",required = true,paramType = "path")})
    @ApiResponses({@ApiResponse(code=400,message="id为空")})
    @RequestMapping("list1")
    public List<Room> list1(HttpServletRequest request){
        System.out.println("================="+request.getRequestURI());
        List<Room> list = roomService.list();
        return list;
    }
}
